package MTT::Schema::Result::User;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use namespace::autoclean;
extends 'DBIx::Class::Core';

__PACKAGE__->load_components("InflateColumn::DateTime", "EncodedColumn");

=head1 NAME

MTT::Schema::Result::User

=cut

__PACKAGE__->table("users");

=head1 ACCESSORS

=head2 id

  data_type: 'integer'
  is_auto_increment: 1
  is_nullable: 0

=head2 username

  data_type: 'varchar'
  is_nullable: 0
  size: 23

=head2 password

  data_type: 'varchar'
  is_nullable: 0
  size: 64

=head2 email

  data_type: 'varchar'
  is_nullable: 0
  size: 42

=head2 fio

  data_type: 'varchar'
  is_nullable: 0
  size: 42

=head2 inner_phone

  data_type: 'varchar'
  is_nullable: 1
  size: 15

=head2 phone

  data_type: 'varchar'
  is_nullable: 1
  size: 15

=head2 department

  data_type: 'varchar'
  is_nullable: 1
  size: 30

=head2 comment

  data_type: 'text'
  is_nullable: 1

=cut

__PACKAGE__->add_columns(
  "id",
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
  "username",
  { data_type => "varchar", is_nullable => 0, size => 23 },
  "password",
  { data_type => "varchar", is_nullable => 0, size => 64 },
  "email",
  { data_type => "varchar", is_nullable => 0, size => 42 },
  "fio",
  { data_type => "varchar", is_nullable => 0, size => 42 },
  "inner_phone",
  { data_type => "varchar", is_nullable => 1, size => 15 },
  "phone",
  { data_type => "varchar", is_nullable => 1, size => 15 },
  "department",
  { data_type => "varchar", is_nullable => 1, size => 30 },
  "comment",
  { data_type => "text", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("email", ["email"]);
__PACKAGE__->add_unique_constraint("username", ["username"]);

=head1 RELATIONS

=head2 access_objects

Type: has_many

Related object: L<MTT::Schema::Result::AccessObject>

=cut

__PACKAGE__->has_many(
  "access_objects",
  "MTT::Schema::Result::AccessObject",
  { "foreign.id_user" => "self.id" },
  { cascade_copy => 0, cascade_delete => 0 },
);

=head2 recipients

Type: has_many

Related object: L<MTT::Schema::Result::Recipient>

=cut

__PACKAGE__->has_many(
  "recipients",
  "MTT::Schema::Result::Recipient",
  { "foreign.id_user" => "self.id" },
  { cascade_copy => 0, cascade_delete => 0 },
);

=head2 reports

Type: has_many

Related object: L<MTT::Schema::Result::Report>

=cut

__PACKAGE__->has_many(
  "reports",
  "MTT::Schema::Result::Report",
  { "foreign.id_user" => "self.id" },
  { cascade_copy => 0, cascade_delete => 0 },
);

=head2 user_roles

Type: has_many

Related object: L<MTT::Schema::Result::UserRole>

=cut

__PACKAGE__->has_many(
  "user_roles",
  "MTT::Schema::Result::UserRole",
  { "foreign.user_id" => "self.id" },
  { cascade_copy => 0, cascade_delete => 0 },
);


# Created by DBIx::Class::Schema::Loader v0.07002 @ 2010-11-28 20:38:51
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:b+iQRXUiCNG0RS7En3VcoQ


# You can replace this text with custom content, and it will be preserved on regeneration


__PACKAGE__->many_to_many(roles => 'user_roles', 'role'); 

__PACKAGE__->add_columns(
	password => {
		data_type 	=> 'varchar',
		size	  	=> 64,
		is_nullable => 0,
		encode_column => 1,
		encode_class  => 'Digest',
		encode_args	  => {algorithm => 'MD5', format => 'hex'},
		encode_check_method => 'check_password',
	}
);

__PACKAGE__->meta->make_immutable;
1;
